const path = require('path');
const resolve = (dir) => path.resolve(__dirname, dir);
module.exports = {
  webpack: {
    alias: {
      '@': resolve('src'),
      '@components': resolve('src/components'),
      '@img': resolve('src/assets/img'),
      '@css': resolve('src/assets/css')
    },
    resolve: {
      extensions: ['.js', '.jsx', '.ts', '.tsx']
    },
    module: {
      rules: [
        {
          test: /\.(j|t)sx?$/,
          use: [
            {
              loader: 'babel-loader'
            }
          ],
          exclude: /node_modules/
        }
      ]
    }
  },
  devServer: {
    proxy: {
      '/node': {
        target: 'http://43.136.36.160:8000',
        changeOrigin: true,
        pathRewrite: { '^/node': '' }
      },
      // 屠宰模块
      '/server': {
        target: 'http://120.25.178.186/',
        changeOrigin: true
        // pathRewrite: { '^/server': '' }
      },
      //屠宰仓库模块
      '/zk': {
        target: 'http://120.25.178.186/',
        changeOrigin: true
        // pathRewrite: { '^/zk': '' }
      },
      //物流模块
      '/logistics': {
        target: 'http://120.25.178.186:10105/',
        changeOrigin: true,
      /*   pathRewrite: { '^/logistics': '/logistics/applicationLogistics/' } */
      },
      //饲料仓库模块
      '/goods': {
        target: 'http://120.25.178.186:10104/',
        changeOrigin: true
        /*  pathRewrite: { '^/godds': '' } */
      },
      // 加工模块
      '/processing': {
        target: 'http://120.25.178.186/',
        changeOrigin: true
        // pathRewrite: { '^/processing': '' }
      },
      // 养殖、饲料模块
      '/feed': {
        target: 'http://120.25.178.186:10103/',
        changeOrigin: true,
        pathRewrite: { '^/feed': '' }
      },
      '/hardware': {
        target: 'http://119.91.26.59:1235/',
        changeOrigin: true,
        pathRewrite: { '^/hardware': '' }
      }
    }
  }
};
